/*
 * 资源管理 2010-01-15
 * author : tss
 * 
 */

//url 路径前缀
var startUrl = "/permission/resc/";
var Resc = {

	id : "Resc",
	enterNewUrl : startUrl+"enterNew.html",
	enterEditUrl : startUrl+"enterEdit.html",
	enterViewUrl : startUrl+"enterView.html",
	saveUrl : startUrl + "save.html",
	updateUrl : startUrl + "update.html",
	removeUrl : startUrl + "delete.html",
	queryUrl : startUrl + "list.html",
	backQueryUrl : startUrl + "toList.html",
	chkIds : "chkIds",
	form : function(){
	  return document.forms[0];
    },

	// 校验
	validate : function() {
		/*try {
			return Validator.Validate(Resc.form(), 3);
		} catch (e) {
			alert(e.message);
		}
		return false;*/
    	return true;
	},

	//首页
	desktop : function () {
	   
	  doSubmit(Resc.form(),initVar.desktopUrl);
	},
	
	// 查询
	search : function search() {
		doSubmit(Resc.form(), Resc.queryUrl);
	},

	//进入新增
	enterNew : function() {

		var id = getSelectFirstId(Resc.chkIds);
		doSubmit(Resc.form(), Resc.enterNewUrl+'?id='+id);
	},
	
	//进入修改
	enterEdit : function(id) {
		
		doSubmit(Resc.form(), Resc.enterEditUrl+'?id='+id);
	},

	// 进入详细
	enterView : function(id) {

		doSubmit(Resc.form(), Resc.enterViewUrl + "?id=" + id);
	},

	// 删除
	remove : function() {

		commonRemove(Resc.form(), Resc.removeUrl, Resc.chkIds);
	},

	//保存
	save : function() {

		doSubmit(Resc.form(), Resc.saveUrl);
	},
	
	//修改
	update : function() {
		
		doSubmit(Resc.form(), Resc.updateUrl);
	},


	// 返回
	goBack : function() {

		doSubmit(Resc.form(), Resc.backQueryUrl);
	}
};

//加载
window.onload = function() {

	setTbStyle();
	execEvent(Resc,"INPUT","button");
	execEvent(Resc,"A");
};
